package VLSys;

import java.awt.*;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Toolkit;
import javax.swing.*;


public class LoginModule extends JPanel{
   
        JTextField user;
	JPasswordField password;
        ImageStore backdrop;
	JButton loginButton;
        JButton exitButton;
        
    public LoginModule(){

        setVisible(true);
        setLayout (null);
        setFocusable(true);
        setBackground(Color.white);
        
        user = new JTextField(11);
	password = new JPasswordField(11);
        
        user.setBounds(195,63,170,19);
        user.setBackground(Color.white);
        user.setBorder(null);
        
        password.setBounds(195,98,170,19);
        password.setBackground(Color.white);
        password.setBorder(null);
        
        loginButton = new JButton();
        loginButton.setOpaque(false);
        loginButton.setBounds(280,124,28,13);
        
        exitButton = new JButton();
        exitButton.setOpaque(false);
        exitButton.setBounds(338,124,28,13);
        
        //backdrop = new ImageStore("images/login_screen.jpg");
        
        add(user);
	add(password);
	add(loginButton);
        add(exitButton);
        
        backdrop = new ImageStore("images/login_screen.png");
    }

    public void clearlogin()
    {   
       user.setText(null);
       password.setText(null);
    }

    public void paint(Graphics g){
       super.paint(g);
       Graphics2D backg = (Graphics2D)g;

       backg.drawImage(backdrop.getImage(), 0, 0, this);

       Toolkit.getDefaultToolkit().sync();
       g.dispose();
   }
}
